﻿@using FwProject.Com.Dto
@model ContentTypeEnterDto
@{
}
<style>
    .hidden {
        display: none;
    }
</style>
<form id="form0" class="layui-form" action="@Url.Action("TypeCreate")" method="post" novalidate="novalidate" data-ajax="true" data-ajax-begin="LockAjaxCallbackBack" data-ajax-success="ReloadAjaxCallbackgoback" data-ajax-failure="FailureAjaxCallback" data-ajax-method="Post" role="form" lay-filter="form1">
    <div class="layui-form layui-form-pane" style="padding:10px;">
        <div class="layui-form-item">
            @Html.LabelFor(o => o.Name, new { @class = "layui-form-label" })
            <div class="layui-input-block">
                @Html.TextBoxFor(o => o.Name, new { @class = "layui-input" })
                @Html.ValidationMessageFor(o => o.Name)
            </div>
        </div>
        <div class="layui-layer-btn layui-layer-btn-" style="padding:8px 12px;z-index:1000;position: fixed;bottom:0;left: 1px;width: 98%;height: 50px; background:rgba(230,230,230,0.8)">
            <a id="save" class="layui-layer-btn0" lay-submit="" lay-filter="saveprops">保存</a>
        </div>
    </div>
</form>

@section scripts{
    <script src="~/js/main.js"></script>
    @*<script src="~/Theme/js/plugins/layer/laydate/laydate.js"></script>*@
    <script src="~/js/laydate/laydate.js"></script>
    <script type="text/javascript">
        var form, layer, layedit;
        layui.use(['form', 'layedit', 'layer'], function () {
            layedit = layui.layedit;
            form = layui.form;
            layer = layui.layer;

            //自定义验证规则
            form.verify({
                required: function (value) {
                    if (value == "") {
                        return '必填项不能为空';
                    }
                }
            });
        })

        function ReloadAjaxCallbackgoback(data, successInfo) {
            if (data.success) {
                layer.msg('保存成功！')
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭当前iframe页面
            } else {
                layer.msg('保存失败：' + successInfo);
            }
        }

        $('#save').on('click', function () {
            $('#form0').submit();
        });

        $(document).ready(function () {

        });
    </script>
}

